/*******************************************************************************
* Project: QSAR(Cute Software Architecture) 
*
* Copyright: Copyright(C) 2024 by YuetingBen, All Rights Reserved
*
* File name: Rtos.c
*
* Brief: ;
*
* Author: Yueting.Ben
*
* Module: RTOS
*
*******************************************************************************/


/** HEADER FILES **/
#include "Rtos.h"


/** TYPEDEF DEFINITION **/


/** MACRO DEFINITION **/


/** GLOBAL DATA DEFINITION **/
void RTOS_CyclicTask_1ms(void *argument);
void RTOS_CyclicTask_5ms(void *argument);
void RTOS_CyclicTask_10ms(void *argument);

/** LOCAL DATA DEFINITION **/


/** LOCAL FUNCTION DECLARATION **/


/** GLOBAL FUNCTION DECLARATION **/


/** LOCAL FUNCTION **/


/** GLOBAL FUNCTION **/
void RTOS_CyclicTask_1ms(void *argument)
{
    Tm_Init((const Tm_ConfigType*)&Tm_Config);
    
    for(;;)
    {
        Can_MainFunction();     
        Tm_MainFunction_Cyclic_1ms();

        osDelay(1);
    }
}


void RTOS_CyclicTask_5ms(void *argument)
{
    NvM_Init((const NvM_ConfigType*)&NvMConfig);
    CanTp_Init((const CanTp_ConfigType*)&CanTp_Config);
    Dcm_Init();
    Dem_Init((const Dem_ConfigType*)&Dem_Config);
    CanSM_Init((const CanSM_ConfigType*)&CanSM_Config);
    CanNm_Init((const CanNm_ConfigType*)&CanNm_Config);
    Xcp_Init((const Xcp_ConfigType*)&Xcp_Config);

    for(;;)
    {
        Dem_MainFunction();
        NvM_MainFunction();
        CanNm_MainFunction();
        CanTp_MainFunction();
        DcmDsl_MainFunction();
        Com_MainFunctionTx();
        Com_MainFunctionRx();
        AppCom_MainFunction();
        Xcp_MainFunction();
        
        osDelay(5);
    }
}


void RTOS_CyclicTask_10ms(void *argument)
{
    AppDiag_Init((const AppDiag_ConfigType*)&AppDiag_Config);
    for(;;)
    {
        AppTest_MainFunction();
        
        osDelay(10);
    }
}